package gisc.gov.vn.dev.xtable;

import java.sql.Types;
import java.util.LinkedList;
import java.util.List;

/**
 * @author hdk
 *
 */

public class XTableProperties implements IXColTypePair {
	
	private String _tableName="";
	private int _columnCount=0;
	private List<String> _columnNames=new LinkedList<String>();
	private List<java.sql.Types> _types=new LinkedList<java.sql.Types>();
	private List<XColTypePair> _allPair=new LinkedList<XColTypePair>();
	
	public XTableProperties(String table_name)
	{
		_tableName=table_name;
	}
	
	public XTableProperties(String table_name,int column_count)
	{
		_tableName=table_name;
		_columnCount=column_count;
	}
	
	/* (non-Javadoc)
	 * @see gisc.gov.vn.dev.xtable.IXColTypePair#GetPair(int)
	 */
	@Override
	public XColTypePair GetPair(int index) {
		//return new XColTypePair(_columnNames.get(index), _types.get(index));
		return _allPair.get(index);
	}

	/* (non-Javadoc)
	 * @see gisc.gov.vn.dev.xtable.IXColTypePair#Add(java.lang.String, java.sql.Types)
	 */
	@Override
	public void Add(String column_name, Types type) {
		_columnNames.add(column_name);
		_types.add(type);
		_allPair.add(new XColTypePair(column_name, type));
	}

	/**
	 * @return the _columnCount
	 */
	public int get_columnCount() {
		return _columnCount;
	}

	/**
	 * @return the _columnNames
	 */
	public List<String> get_columnNames() {
		return _columnNames;
	}

	/* (non-Javadoc)
	 * @see gisc.gov.vn.dev.xtable.IXColTypePair#GetTableName()
	 */
	@Override
	public String GetTableName() {
		// TODO Auto-generated method stub
		return _tableName;
	}

	/* (non-Javadoc)
	 * @see gisc.gov.vn.dev.xtable.IXColTypePair#GetAllPair()
	 */
	@Override
	public List<XColTypePair> GetAllPair() {
		// TODO Auto-generated method stub
		return _allPair;
	}
	
	
	

}
